<?php
namespace Laoha\Blog\Admin\Forms\Appsets;

use Illuminate\Support\Facades\Schema;
use Encore\Admin\Widgets\Form;
use App\Admin\Forms\Appsets\Setbase;
use Laoha\Blog\Models\LaohaBlog;

class Blog extends Setbase
{
    /**
     * The form title.
     *
     * @var string
     */
    public $title  = '应用';
 
    /**
     * Build a form here.
     */
    public function form()
    {
		$this->hidden('app_name')->default('laoha_blog');
		$this->divider('应用设置');
		$this->text('title','应用名称');
		$this->divider('表单可选字段');
		$this->select('need.images','图片')->default(1)->options(['禁用','启用','启用且必须']);
		$this->select('need.video','视频')->default(0)->options(['禁用','启用','启用且必须']);		
		$this->select('need.link','外链')->default(0)->options(['禁用','启用','启用且必须']);
		$this->divider('编辑器选择');
		$this->select('editor','编辑器选择')->default('html')->options(['html'=>'HTML','md'=>'MokeDown','txt'=>'TEXT']);
		$this->divider('字段翻译');		
		$columns = Schema::getColumnListing((new LaohaBlog())->getTable());
		foreach($columns as $col){
			$this->text('fields.'.$col,$col)->default($col);
		}
    }

}
